package com.vin.sentinel.examples;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * <br>
 *
 * @author levin
 * @version 1.0.0
 */
@Slf4j
@RestController
public class TestController {
    @SentinelResource()
    @RequestMapping("/index")
    public Map<String, String> index() {
        HashMap<String, String> stringObjectHashMap = new HashMap<>();
        stringObjectHashMap.put("code", "200");
        stringObjectHashMap.put("message", "请求成功");
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {

        }
        log.info("-----------------------");
        return stringObjectHashMap;
    }
}
